package shop.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import shop.mapper.StorageRecordMapper;
import shop.pojo.StorageRecord;
import shop.service.StorageRecordService;

import java.util.List;

@Service
public class StorageRecordServiceImpl implements StorageRecordService {

    @Autowired
    StorageRecordMapper storageRecordMapper;
    @Override
    public Integer getStorageRecordCount(String queryGoodsName, String querySupplierId, String queryPayStatus) {
        return storageRecordMapper.getStorageRecordCount(queryGoodsName,querySupplierId,queryPayStatus);
    }

    @Override
    public List<StorageRecord> getStorageRecordList(String queryGoodsName, String querySupplierId, String queryPayStatus, Integer pageIndex, int pageSize) {
        return storageRecordMapper.getStorageRecordList(queryGoodsName,querySupplierId,queryPayStatus,pageIndex,pageSize);
    }

    @Override
    public StorageRecord getStorageRecordDetail(Integer storageRecordId) {
        return storageRecordMapper.getStorageRecordDetail(storageRecordId);
    }

    @Override
    public int update(StorageRecord storageRecord) {
        return storageRecordMapper.update(storageRecord);
    }

    @Override
    public Integer deleteStorageRecordById(Integer storageRecordId) {
        return storageRecordMapper.delete(storageRecordId);
    }

    @Override
    public boolean add(StorageRecord storageRecord) {
        if(storageRecordMapper.add(storageRecord)>0){
            return true;
        }else {
            return false;
        }
    }
}
